<?php
$this->breadcrumbs = array(
    'Post' => array('index'),
    'Manage',
);
?>
<div class="box">
    <header>
        <h5><i class="icon icon-user"></i> - Manager post</h5>
    </header>
    <div class="box">

	<?php
	$this->widget('bootstrap.widgets.TbGridView', array(
	    'id' => 'post-grid',
	    'dataProvider' => $model->search(),
	    'filter' => $model,
	    'columns' => array(
		array(
		    'name' => 'post_type',
		    'header' => 'Post Type',
		    'type' => 'raw',
		    'value' => function($data) {
			return $data->getType();
		    },
		    'filter' => Posts::getListType()
		),
		'title',
//		array(
//		    'name' => 'total_like',
//		    'filter' => false
//		),
		array(
		    'header' => 'Poster',
		    'name' => 'userName',
		    'value' => '$data->user->username'
		),
		array(
		    'name' => 'total_comment',
		    'type' => 'raw',
		    'value' => function($data) {
			return '<a href="' . BACKEND_SITE_URL . 'comment?post=' . $data->post_id . '&title=' . urlencode($data->title) . '">' . $data->total_comment . '</a>';
		    },
		    'filter' => false
		),
		array(
		    'name' => 'time_created',
		    'type' => 'raw',
		    'value' => function($data) {
			return date('m-d-Y', strtotime($data->time_created));
		    },
		    'filter' => false
		),
		/*
		  'activation_key',
		  'type',
		  'status',
		  'joined',
		  'first_name',
		  'last_name',
		  'gender',
		  'social_provider',
		  'social_uid',
		  'access_token',
		  'bio',
		  'last_login_time',
		  'last_login_ip',
		  'country',
		  'state',
		  'city',
		  'address',
		  'phone',
		  'telephone',
		  'mobile',
		  'postcode',
		  'featured',
		  'avatar',
		  'webpage',
		  'timezone',
		  'language',
		 */
		array(
		    'class' => 'bootstrap.widgets.TbButtonColumn',
		    'template' => '{update}{delete}'
		),
	    ),
	));
	?>
    </div>
</div>